<?php
/**
 *
 * User: chenzheng
 * Date: 2023/5/20
 * Time: 10:42
 */

namespace app\api\controller;


use app\common\controller\IndexController;
use app\api\library\promotion\addPromotionUser;
use app\api\library\promotion\getPromotionUser;
use app\api\library\promotion\getPromotionUserQrCode;
use app\api\library\promotion\getUserPromotionInfo;
use app\api\library\promotion\getPromotionUserList;

class Promotion extends IndexController
{
    /**
     * 申请成为推广人
     */
    public function addPromotionUser()
    {
        $req = $this->run(WEB_KEY);
//        $req = request()->param();
        //处理参数
        $display = [
            ['userId', 'ui', 'int'],
            ['mobile', 'me', 'int'],
            ['name', 'ne', 'str'],
            ['id_number', 'in', 'str'],
        ];
        //校验参数
        $param = _displayParam($req, $display);
        
        
        addPromotionUser\V::run($param);
    }
    
    /**
     * 查询用户推广状态
     */
    public function getPromotionUser()
    {
        $req = $this->run(WEB_KEY);
//        $req = request()->param();
        //处理参数
        $display = [
            ['userId', 'ui', 'int'],
        ];
        //校验参数
        $param = _displayParam($req, $display);
        
        
        getPromotionUser\V::run($param);
    }
    
    /**
     * 推广人增加推广用户
     */
//    public function addPromotionCustomer()
//    {
//        $req = $this->run(WEB_KEY);
////        $req = request()->param();
//        //处理参数
//        $display = [
//            ['promotionId', 'pi', 'int'],
//            ['userId', 'ui', 'int'],
//        ];
//        //校验参数
//        $param = _displayParam($req, $display);
//
//
//        addPromotionCustomer\V::run($param);
//    }
    /**
     * 获取用户推广积分记录
     */
    public function getUserPromotionInfo()
    {
        $req = $this->run(WEB_KEY);
//        $req = request()->param();
        //处理参数
        $display = [
            ['userId', 'ui', 'int'],
            ['date', 'de', 'str'],
            ['page', 'pe', 'int', 1],
            ['limit', 'lt', 'int', 3],
        ];
        //校验参数
        $param = _displayParam($req, $display);
        
        
        getUserPromotionInfo\V::run($param);
    }
    
    /**
     * 获取用户推广积分记录
     */
    public function getPromotionUserList()
    {
        $req = $this->run(WEB_KEY);
//        $req = request()->param();
        //处理参数
        $display = [
            ['userId', 'ui', 'int'],
            ['page', 'pe', 'int', 1],
            ['limit', 'lt', 'int', 3],
        ];
        //校验参数
        $param = _displayParam($req, $display);
    
    
        getPromotionUserList\V::run($param);
    }
    
    /**
     * 获取用户分享二维码
     */
    public function getPromotionUserQrCode()
    {
        $req = $this->run(WEB_KEY);
//        $req = request()->param();
        //处理参数
        $display = [
            ['userId', 'ui', 'int'],
        ];
        //校验参数
        $param = _displayParam($req, $display);
    
    
        getPromotionUserQrCode\V::run($param);
    }
}